********************************************************************************
* Name			: Table 1 - Background characteristics by gender
*
* Description	: This dofile shows the code used for each row
********************************************************************************
use dataset_long.dta, clear

*Age
tabstat age if gender==0, s(mean sem) c(s)
tabstat age if gender==1, s(mean sem) c(s)
tabstat age , s(mean sem) c(s)
ttest age, by(gender)

*Children and children characteristics
tabstat children childrenprimary gender_child_chosen, s(mean sem) c(s)

*Education and employment status
tabstat primary secondary_some secondary_more unemp selfemp psector if gender==0, s(mean sem) c(s)
tabstat primary secondary_some secondary_more unemp selfemp psector if gender==1, s(mean sem) c(s)
tabstat primary secondary_some secondary_more unemp selfemp psector, s(mean sem) c(s)

foreach v of varlist primary secondary_some secondary_more unemp selfemp psector{
ttest `v', by(gender)
}

********************************************************************************
* Name			: Table 2 - Decision-making power
*
* Description	: This dofile shows the code used for each row
********************************************************************************
use dataset_long.dta, clear

*Children's education
tabstat p_educ1 p_educ2 p_educ3 if gender==1, s(mean)
tabstat p_educ1 p_educ2 p_educ3 if gender==0, s(mean)

*Wife's health
tabstat p_health1 p_health2 p_health3 if gender==1, s(mean)
tabstat p_health1 p_health2 p_health3 if gender==0, s(mean)

*Major household purchses
tabstat p_purchases1 p_purchases2 p_purchases3 if gender==1, s(mean)
tabstat p_purchases1 p_purchases2 p_purchases3 if gender==0, s(mean)

*Visits to wife's family
tabstat p_visit1 p_visit2 p_visit3 if gender==1, s(mean)
tabstat p_visit1 p_visit2 p_visit3 if gender==0, s(mean)

********************************************************************************
* Name			: Table 3 - Allocation and preferences
*
* Description	: This dofile shows the code used for each row
********************************************************************************
use dataset_wide_appendix.dta, clear

tabstat dist_child dist_wife dist_husband time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1, s(mean sd p25 med p75) 

********************************************************************************
* Name			: Table 4 - Effect of increasing the wife's bargaining power on
*				  the allocation to the child's education
* Description	: This dofile shows the code used for each Column
********************************************************************************
use dataset_wide.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

*Column (1)
reg dist_child t2 t3 t4, robust
test t2=t3
test t3=t4
test t2=t4

*Column (2)
reg dist_child t2 t3 t4 i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (3)
reg dist_child t2 t3 t4 $bg_child i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (4)
reg dist_child t2 t3 t4 $bg_child $bg_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (5)
reg dist_child t2 t3 t4 $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

********************************************************************************
* Name			: Table 5 - Effect of increasing the wife's bargaining power on
*				  the allocation to the wife and the husband
* Description	: This dofile shows the code used for each Column
********************************************************************************
use dataset_wide.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

*Column (1)
reg dist_wife t2 t3 t4 $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (2)
reg dist_husband t2 t3 t4 $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

********************************************************************************
* Name			: Table 6 - Heterogeneity in time- and risk preference difference
*				  and gender of the child
* Description	: This dofile shows the code used for each Column
********************************************************************************
global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_child_nogender std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk
global diff_parent_notime educ_diff risk
global diff_parent_norisk educ_diff time 

*Column (1)
reg dist_child time t2 t3 t4 t2Xtime t3Xtime t4Xtime $bg_child $bg_parent $diff_parent_notime i.session, robust
lincom t2 + t2Xtime
lincom t3 + t3Xtime
lincom t4 + t4Xtime 

*Column (2)
reg dist_child risk t2 t3 t4 t2Xrisk t3Xrisk t4Xrisk $bg_child $bg_parent $diff_parent_norisk i.session, robust
lincom t2 + t2Xrisk
lincom t3 + t3Xrisk
lincom t4 + t4Xrisk

*Column (3)
reg dist_child gender_child_chosen t2 t3 t4 t2Xmale t3Xmale t4Xmale $bg_child_nogender $bg_parent $diff_parent i.session, robust
lincom t2 + t2Xmale
lincom t3 + t3Xmale
lincom t4 + t4Xmale 

